package matlap.client.view.student;

import matlap.client.view.MatlapGWT;

import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.MenuBar;
import com.google.gwt.user.client.ui.MenuItem;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.ui.MenuItemSeparator;

public class StudentMenuComposite extends Composite {

	private Panel bigPanel;
	private String who;
	private MenuItem mntmAdataim;
	private MenuItem mntmHatar;
	private MenuItem mntmRang;
	private MenuItem mntmPont;
	private MenuItem mntmFel;
	private MatlapGWT matlap;

	public StudentMenuComposite(Panel bigP, String w, MatlapGWT matlapGWT) {

		bigPanel = bigP;
		who = w;
		matlap = matlapGWT;
		final VerticalPanel verticalPanel = new VerticalPanel();
		initWidget(verticalPanel);
		verticalPanel.setSize("151px", "118px");

		MenuBar menuBar_1 = new MenuBar(true);
		menuBar_1.setStyleName("MenuBar2");
		verticalPanel.add(menuBar_1);
		menuBar_1.setSize("151px", "168px");

		mntmFel = new MenuItem("Feladat beküldés", false, new Command() {
			public void execute() {
				bigPanel.clear();
				bigPanel.add(new TaskUploadComposite(who));
				matlap.setUnSelectedMenuItem();
				mntmFel.setStyleName("SelectedMenuItem2");
				mntmPont.setStyleName("MenuItem2");
				mntmRang.setStyleName("MenuItem2");
				mntmHatar.setStyleName("MenuItem2");
				mntmAdataim.setStyleName("MenuItem2");
			}
		});
		mntmFel.setStyleName("MenuItem2");
		menuBar_1.addItem(mntmFel);
		mntmFel.setSize("151", "44");

		MenuItemSeparator separator = new MenuItemSeparator();
		separator.setStyleName("MenuItemSeparator2");
		menuBar_1.addSeparator(separator);
		separator.setSize("151", "2");

		mntmPont = new MenuItem("Pontjaim", false, new Command() {
			public void execute() {
				bigPanel.clear();
				bigPanel.add(new MyScoresComposite(who));
				matlap.setUnSelectedMenuItem();
				mntmFel.setStyleName("MenuItem2");
				mntmPont.setStyleName("SelectedMenuItem2");
				mntmRang.setStyleName("MenuItem2");
				mntmHatar.setStyleName("MenuItem2");
				mntmAdataim.setStyleName("MenuItem2");
			}
		});
		mntmPont.setStyleName("MenuItem2");
		menuBar_1.addItem(mntmPont);
		mntmPont.setSize("151", "23");

		MenuItemSeparator separator_3 = new MenuItemSeparator();
		separator_3.setStyleName("MenuItemSeparator2");
		menuBar_1.addSeparator(separator_3);
		separator_3.setSize("151", "2");

		mntmRang = new MenuItem("Rangsor", false, new Command() {
			public void execute() {
				bigPanel.clear();
				bigPanel.add(new HierarchyComposite());
				matlap.setUnSelectedMenuItem();
				mntmFel.setStyleName("MenuItem2");
				mntmPont.setStyleName("MenuItem2");
				mntmRang.setStyleName("SelectedMenuItem2");
				mntmHatar.setStyleName("MenuItem2");
				mntmAdataim.setStyleName("MenuItem2");
			}
		});
		mntmRang.setStyleName("MenuItem2");
		menuBar_1.addItem(mntmRang);
		mntmRang.setSize("151", "23");

		MenuItemSeparator separator_4 = new MenuItemSeparator();
		separator_4.setStyleName("MenuItemSeparator2");
		menuBar_1.addSeparator(separator_4);
		separator_4.setSize("151", "2");

		mntmHatar = new MenuItem("Határidők", false, new Command() {
			public void execute() {
				bigPanel.clear();
				bigPanel.add(new DeadlinesComposite());
				matlap.setUnSelectedMenuItem();
				mntmFel.setStyleName("MenuItem2");
				mntmPont.setStyleName("MenuItem2");
				mntmRang.setStyleName("MenuItem2");
				mntmHatar.setStyleName("SelectedMenuItem2");
				mntmAdataim.setStyleName("MenuItem2");
			}
		});
		mntmHatar.setStyleName("MenuItem2");
		menuBar_1.addItem(mntmHatar);
		mntmHatar.setSize("151", "23");

		MenuItemSeparator separator_5 = new MenuItemSeparator();
		separator_5.setStyleName("MenuItemSeparator2");
		menuBar_1.addSeparator(separator_5);
		separator_5.setSize("151", "2");

		mntmAdataim = new MenuItem("Adataim", false, new Command() {
			public void execute() {
				bigPanel.clear();
				StudentAccountComposite t = new StudentAccountComposite(who);
				bigPanel.add(t);
				matlap.setUnSelectedMenuItem();
				mntmFel.setStyleName("MenuItem2");
				mntmPont.setStyleName("MenuItem2");
				mntmRang.setStyleName("MenuItem2");
				mntmHatar.setStyleName("MenuItem2");
				mntmAdataim.setStyleName("SelectedMenuItem2");
			}
		});
		mntmAdataim.setStyleName("MenuItem2");
		menuBar_1.addItem(mntmAdataim);
		mntmAdataim.setSize("151", "23");

	}

	public void setUnSelectedMenuItems() {
		mntmFel.setStyleName("MenuItem2");
		mntmPont.setStyleName("MenuItem2");
		mntmRang.setStyleName("MenuItem2");
		mntmHatar.setStyleName("MenuItem2");
		mntmAdataim.setStyleName("MenuItem2");

	}

}
